/*  File Name	: ProcResult.h
 *  Author		: Javie Pong
 *	 E-mail		: 823960168@qq.com
 *  Created on	: 2012-8-12
 *  Description:
 */

#ifndef PROCRESULT_H_
#define PROCRESULT_H_
#include "Poker.h"
#include <vector>

enum ResultType
{
	ROYAL_FLUSH		= 10,//皇家同花顺
	STRAIGHT_FLUSH	= 9,//同花顺
	FOUR_OF_A_KIND 	= 8,//四条
	FULL_HOUSE 		= 7,//葫芦
	SUIT			= 6,//同花
	STRAIGHT		= 5,//顺子
	THREE_OF_A_KIND	= 4,//三条
	TWO_PAIRS		= 3,//两对
	ONE_PAIR		= 2,//一对
	HIGH_CARD		= 1,//高牌
	NONE_TYPE		= 0,//未知
};

class EnginePlayer;

class ProcResult
{
public:
	//typedef std::vector<Card> CardVec;

	ProcResult();

	virtual ~ProcResult();

	int make_result(EnginePlayer *player,Card* pri_card[2],Card* pub_card[5]);

	EnginePlayer *player(void);

	ResultType type(void);

	ResultType is_straight_or_royal_flush(CardVec &vec);//同花大顺或同花顺

	ResultType is_four_of_a_kind(CardVec &vec);//四条

	ResultType is_fullhouse(CardVec &vec);//葫芦（三条和一对）

	ResultType is_suit(CardVec &vec);//同花

	ResultType is_straight(CardVec &vec);//顺子

	ResultType is_three_of_a_kind(CardVec &vec);//三条

	ResultType is_two_pairs(CardVec &vec);//两对

	ResultType is_one_pair(CardVec &vec);//一对

	CardVec &result(void);

private:
	int identify_type(CardVec &vec);
	static int card_cmp_num(Card *c1,Card *c2);
	static int card_cmp_type(Card *c1,Card *c2);

	ResultType type_;
	EnginePlayer *player_;
	CardVec result_;
};

#endif /* PROCRESULT_H_ */
